/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.pdx.cs.guavadata.query;

import edu.pdx.cs.guavadata.Channel;
import edu.pdx.cs.guavadata.Transform;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author VuTran
 */
public class AlterTableRename extends Operator {
    private String oldName;
    private String newName;

    /**
     * @return the oldName
     */
    public String getOldName() {
        return oldName;
    }

    /**
     * @param oldName the oldName to set
     */
    public void setOldName(String oldName) {
        this.oldName = oldName;
    }

    /**
     * @return the newName
     */
    public String getNewName() {
        return newName;
    }

    /**
     * @param newName the newName to set
     */
    public void setNewName(String newName) {
        this.newName = newName;
    }

    public AlterTableRename(String oldName, String newName) {
        this.oldName = oldName;
        this.newName = newName;
        this.parent = null;
    }


    @Override
    public void notifyChange(Operator old, Operator newOp) {
        try {
            throw new Exception("The method or operation is not implement.");
        } catch (Exception ex) {
            System.err.println("ERROR: " + ex.toString());
        }
    }

    @Override
    public boolean isQuery() {
        return false;
    }

    @Override
    public SqlText visit(Provider qv) {
        return qv.transform(this);
    }

    @Override
    public void visit(Transform t, Command c) {
        t.expand(this, c);
    }

    @Override
    public Operator clone() {
        return new AlterTableRename(this.oldName, this.newName);
    }

    @Override
    public void visit(Channel c, String table) {
        c.mapAliases(this, table);
    }


}
